package com.huage_07.lesson_07;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

public class PropertiesTest {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("class1\\src\\com\\huage_07\\lesson_07\\Game.txt") ;
        Properties prop = new Properties();

        prop.load(fr);
        String gameCount = prop.getProperty("GameCount");
        int count = Integer.parseInt(gameCount);
        if(count>=3){
            System.out.println("游戏试玩结束，请充值！");
        }else {
            count++;
            System.out.println("第" + count+"局开始");
            GuessNumber.start();
            FileWriter fw = new FileWriter("class1\\src\\com\\huage_07\\lesson_07\\Game.txt");
            prop.setProperty("GameCount",String.valueOf(count));

            prop.store(fw,"GuessNumberGame");

            fr.close();
            fw.close();
        }
    }
}
